<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" scope="page" />
<!DOCTYPE html>
<html>
<head>
	<title>Insert title here</title>
	<link rel="stylesheet" href="${ctx}/css/templatemo_style.css" /> <!-- 页面整体布局样式定义 -->
	<link rel="stylesheet" href="${ctx}/css/ddsmoothmenu.css" /> <!-- 菜单样式定义 -->

	<script type="text/javascript" src="${ctx}/js/jquery-1.4.3.min.js"></script>
	<script type="text/javascript">
		var ctx = "${pageContext.request.contextPath}";

		function showUserName(){
			var name = "${user.username}";
			if(name != ""){
				$("#login").html(name);
				$("#exitP").show();
				$("#login").attr("href", ctx + "/user?flag=info&userId=${user.userId}");
			}else{
				$("#login").html("登录");
				$("#exitP").hide();
				$("#login").attr("href", ctx + "/user?flag=login");
			}
		}

		function gotopage(pageno,pages) { // pageno查询的页数; pages总页数
			if (pageno == 0) {
				pageno = 1;
			}
			if (pageno > pages) {
				pageno = pages;
			}
			$("#pageNo").val(pageno);
			$("#profy").submit();
		}
	</script>
</head>

<body>
	<div id="templatemo_body_wrapper">
		<div id="templatemo_wrapper">


			<!-- header -->
			<div id="templatemo_header">
				<div id="site_title"><h1><a href="">穿美在线鞋城</a></h1></div>
				<div id="header_right">
					<p>
						<a href="" id="login">登录</a>&nbsp;
						<span id="exitP" style="display: none"><a href="${ctx}/user?flag=logout" id="exit">注销</a></span>
					</p>
				</div>
				<div class="cleaner"></div>
			</div>
			<!-- END of templatemo_header -->


			<!-- menu -->
			<div id="templatemo_menubar">
				<div id="top_nav" class="ddsmoothmenu">
					<ul>
						<li><a href="${ctx}/homeservlet">首页</a></li>
						<li><a href="${ctx}/product" class="selected">产品</a></li>
						<li><a href="${ctx}/car?falg=selectcar">我的购物车</a></li>
						<li><a href="${ctx}/order?falg=selectorder">我的订单</a></li>
					</ul>
					<br style="clear: left" />
				</div>
				<!-- end of ddsmoothmenu -->
			</div>
			<!-- END of templatemo_menubar -->


			<!-- main -->
			<div id="templatemo_main">
				<!-- 侧边栏 -->
				<div id="sidebar" class="float_l">
					<!-- sidebar 1 -->
					<div class="sidebar_box">
						<span class="bottom"></span>
						<h3>品牌</h3>
						<div class="content">
							<ul class="sidebar_list">
								<c:forEach var="list" items="${homeList}">
									<li><a href="${ctx}/product?categoryId=${list.category_id}">${list.name}</a></li>
								</c:forEach>
							</ul>
						</div>
					</div>
					<!-- sidebar 2 -->
					<div class="sidebar_box">
						<span class="bottom"></span>
						<h3>热卖单品</h3>
						<div class="content">
							<c:forEach var="listNew" items="${homeListReMai}">
								<div class="bs_box">
									<a href=""><img src='${listNew.imgpath}' alt="image" style="width:62px;height:72px"/></a>
									<h4><a href="javascript:void(0);">${listNew.feature}</a></h4>
									<p class="price">${listNew.price}</p>
									<div class="cleaner"></div>
								</div>
							</c:forEach>
						</div>
					</div>
				</div>
				<!-- END of sidebar -->

				<!-- 内容展示区 -->
				<div id="content" class="float_r">
					<!-- 商品列表展示  -->
					<h3>
						品牌：
						    特步
					</h3>
					<c:forEach var="listCar" items="${listCar}">
						<div class="product_box">
							<a href=""><img src='${listCar.imgpath}' alt="Shoes 2" /></a>
							<p>${listCar.feature}</p>
							<p class="product_price">${listCar.price}</p>
							<a href='${ctx}/car?falg=insertcar&product_id=${listCar.product_id}' class="addtocart"></a>
							<a href="${ctx}/details?product_id=${listCar.product_id}" class="detail"></a>
						</div>
					</c:forEach>
				</div>

				<div class="product_box_fy">
					<p>
						<%-- pageNo; // 当前页
						  pageSize; // 每页显示的行数
						 int pages; // 总页数
						 total; // 总记录数--%>
						<a href="javascript:gotopage(1,${pageInfo.pages});">首页</a> |
						<a href="javascript:gotopage(${pageInfo.pageNo}-1,${pageInfo.pages});">上一页</a> |

						<a href="javascript:void(0);">每页&nbsp;<input type="text" id="ps" name="ps" value="${pageInfo.pageSize}" maxlength="2" style="width: 18px; height: 12px; text-align: center;">&nbsp;条数据 </a> |
						<a href="javascript:void(0);">第<c:out value="${pageInfo.pageNo}"></c:out>页/共<c:out value="${pageInfo.pages}"></c:out>页</a> |

						<a href="javascript:gotopage(${pageInfo.pageNo}+1,${pageInfo.pages});">下一页</a> |
						<a href="javascript:gotopage(${pageInfo.pages},${pageInfo.pages});">尾页</a>

					</p>
				</div>

				<div class="cleaner"></div>
			</div>
			<!-- END of templatemo_main -->


			<!-- footer -->
			<div id="templatemo_footer">
				<p>
					<a href="${ctx}/homeservlet">首页</a> | <a href="${ctx}/product">产品</a> | <a href="${ctx}/car?falg=selectcar">我的购物车</a> | <a href="${ctx}/order?falg=selectorder">我的订单</a>
				</p>
				版权所有 (c) 2018 <a href="javascript:void(0);">金桥软件</a>
			</div>
			<!-- END of templatemo_footer -->


		</div>
		<!-- END of templatemo_wrapper -->
	</div>
	<!-- END of templatemo_body_wrapper -->

	<form action="${ctx}/product" method="post" id="profy">
		<input type="hidden" id="categoryId" name="categoryId" value="${category_id}">
		<input type="hidden" id="pageSize" name="pageSize" value="${pageInfo.pageSize}">
		<input type="hidden" id="pageNo" name="pageNo" value="${pageInfo.pageNo}">
	</form>

	<script type="text/javascript">
		$(function() {
			showUserName();

			$("#ps").change(function() {
				var ps = $(this).val();
				$("#pageSize").val(ps);
				$("#pageNo").val(1);
				$("#profy").submit();
			});
		});
	</script>
	<script type="text/javascript" src="${ctx}/js/stock-check.js"></script> <!-- 添加购物车JS脚本定义 -->
</body>
</html>







